import service from "../index";

export const getAllComment = async () => {
  return await service({
    method: "get",
    url: "/comment/getAllComment",
  });
};

//删除
export const deleteComment = async (id: number) => {
  return await service({
    method: "post",
    url: "/comment/deleteComment",
    data: { id: id },
  });
};

//批量删除
export const batchDeleteComment = async (ids: any) => {
  return await service({
    method: "post",
    url: "/comment/batchDeleteComment",
    data: { ids: ids },
  });
};

//添加
export const addComment = async (params: any) => {
  return await service({
    method: "post",
    url: "/comment/addComment",
    data: params,
  });
};

//修改
export const updateComment = async (params: any) => {
  return await service({
    method: "post",
    url: "/comment/updateComment",
    data: params,
  });
};

//根据评论id获取回复
export const getReply = async (id: number) => {
  return await service({
    method: "post",
    url: "/comment/getReply",
    data: { id: id },
  });
};

//修改回复
export const updateReply = async (params: any) => {
  return await service({
    method: "post",
    url: "/comment/updateReply",
    data: params,
  });
};

//根据评论id查房东
export const getHostByCommentId = async (id: number) => {
  return await service({
    method: "post",
    url: "/comment/getHostByCommentId",
    data: { id: id },
  });
};

//添加回复
export const addReply = async (params: any) => {
  return await service({
    method: "post",
    url: "/comment/addReply",
    data: params,
  });
};

//删除回复
export const deleteReply = async (id: number) => {
  return await service({
    method: "post",
    url: "/comment/deleteReply",
    data: { id: id },
  });
};
